var app = getApp();
Page({
  data: {
    item: [],
    sum: 0,
    Listsum: 0,
    touchEnd: 0,
    touchStart: 0
  },

  touchStart: function (e) {
    var that = this;
    that.setData({
      touchStart: e.timeStamp
    })
  },

  touchEnd: function (e) {
    var that = this;
    that.setData({
      touchEnd: e.timeStamp
    })
  },

  pressTap: function (e) {
    var postid = e.currentTarget.dataset.postid
    var that = this;
    var touchTime = that.data.touchStart - that.data.touchEnd;
    if (touchTime >= 600) { //自定义长按时长，单位为ms
      wx.navigateTo({
        url: '/pages/mark_2/mark_2?id=' + postid,
      })

      app.globalData.pass = this.data.item

      that.setData({
        touchEnd: 0,
        touchStart: 0
      })
    } if (touchTime < 600) {
      that.setData({
        touchEnd: 0,
        touchStart: 0
      })
    }
  },

  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '录取名单'
    })
    var a = 0
    var i
    var items = app.globalData.data
    var item = []
    for (i = 0; i < app.globalData.sum; i++) {
      //判断是否被第一志愿淘汰
      if (items[i].isPass1 == 1) {
        //判断是否发送面试短信
        if (items[i].isUsed2 == 1 && items[i].isUsed1 == 1 && items[i].isUsed == 1) {
          item.push(items[i])
          a++
        }
        //判断是否被第二志愿淘汰
      } else if (items[i].isPass2 == 1) {
        //判断是否发送通知短信
        if (items[i].isUsed2 == 1 && items[i].isUsed1 == 1 && items[i].isUsed == 1) {
          item.push(items[i])
          a++
        }
      }
    }
    this.setData({
      item: item,
      sum: a,
      touchEnd: 0,
      touchStart: 0,
    })
  },
  
  OnIsSendTap: function (event) {
    wx.redirectTo({
      url: '/pages/pass_2/pass_2',
    })
  }
})

